package cn.com.yto56.cainiao.exponent.es.controller;

import cn.com.yto56.cainiao.exponent.elasticsearch.service.ExponentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/exponet")
@Slf4j
@Api(tags = "指数据处理接口")
public class ExponentController {
    @Autowired
    ExponentService exponentService;

    @PostMapping(value = "")
    @ApiOperation(value = "导入样单", httpMethod = "POST")
    public Object upload(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
        return exponentService.executePlugIns(file).getOutputParameter();
    }
}
